$INCLUDE: 'C:\FG\FASTGRAF.FI'

      PROGRAM MAIN

      INTEGER ESC, LEFT, RIGHT, UP, DOWN
      PARAMETER (ESC=1, LEFT=75, RIGHT=77, UP=72, DOWN=80)

      INTEGER FG_KBTEST
      CHARACTER*18 KEYS

      CALL FG_INITPM
      CALL FG_KBINIT(1)
      WRITE(6,*) 'Keyboard handler enabled.'

10    KEYS = ' '
      IF (FG_KBTEST(LEFT)  .EQ. 1) KEYS(1:4) = 'LEFT'
      IF (FG_KBTEST(RIGHT) .EQ. 1) KEYS(6:10) = 'RIGHT'
      IF (FG_KBTEST(UP)    .EQ. 1) KEYS(12:13) = 'UP'
      IF (FG_KBTEST(DOWN)  .EQ. 1) KEYS(15:18) = 'DOWN'
      WRITE(6,*) 'keys pressed:  ', KEYS
      CALL FG_WAITFOR(18)
      IF (FG_KBTEST(ESC) .EQ. 0) GO TO 10

      CALL FG_KBINIT(0)
      WRITE(6,*) 'Keyboard handler disabled.'

      STOP ' '
      END
